<!DOCTYPE html>
<html lang="en-US">
    <head>
        <title>Win32::API - Perl Win32 API Import Facility - metacpan.org</title>
        <link rel="preload" as="fetch" href="https://metacpan.org/account/login_status" crossorigin="anonymous" />
        <link href="https://metacpan.org/_assets/b8ccceeed47a0652049703d99326a9cea4933443.css" rel="stylesheet" type="text/css">
        <script src="https://metacpan.org/_assets/6bfedafe2d7caa915b7d84f61b45936818e3242e.js" type="text/javascript" defer></script>
        <link rel="alternate" type="application/rss+xml" title="Recent CPAN Uploads of Win32-API - MetaCPAN" href="https://metacpan.org/dist/Win32-API/releases.rss" />
        <link rel="canonical" href="./Win32::API.html" />
        <meta name="description" content="Perl Win32 API Import Facility" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <link rel="shortcut icon" href="https://metacpan.org/static/icons/favicon.ico">
        <link rel="apple-touch-icon" sizes="152x152" href="https://metacpan.org/static/icons/apple-touch-icon.png">
        <link rel="search" href="https://metacpan.org/static/opensearch.xml" type="application/opensearchdescription+xml" title="MetaCPAN">
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          (function(skey, ga_id){
            ga('create', ga_id, {
              siteSpeedSampleRate : 100,
              storage             : 'none',
              clientId            : localStorage.getItem(skey)
            });
            ga(function(tracker) {
              localStorage.setItem(skey, tracker.get('clientId'));
            });
            ga('send', 'pageview');
          })('ga:clientId', 'UA-27829474-1');
        </script>
<meta name="twitter:card"        content="summary" />
<meta name="twitter:url"         content="https://metacpan.org/pod/Win32::API" />
<meta name="twitter:title"       content="Win32::API" />
<meta name="twitter:description" content="Perl Win32 API Import Facility" />
<meta name="twitter:site"        content="metacpan" />
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="header-logo-large hidden-xs">
              <a href="https://metacpan.org/" tabindex="0">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#logo" />
                </svg>
              </a>
            </div>
            <div class="header-logo-icon visible-xs">
              <a href="https://metacpan.org/">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#dots" />
                </svg>
              </a>
            </div>
            <ul class="nav navbar-nav menu-items hidden-xs hidden-sm">
              <li><a href="https://metacpan.org/about">About</a></li>
              <li><a href="https://metacpan.org/about/sponsors">Sponsor</a></li>
              <li><a href="https://grep.metacpan.org/">grep::cpan</a></li>
              <li><a href="https://metacpan.org/recent">Recent</a></li>
              <li><a href="https://metacpan.org/about/faq">FAQ</a></li>
              <li><a href="https://metacpan.org/tools">Tools</a></li>
              <li><a href="https://fastapi.metacpan.org/">API</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <button type="button" class="searchbar-btn visible-xs visible-sm">
                    <i class="fa fa-search button-fa-icon"></i>
                </button>
                <form action="https://metacpan.org/search" class="searchbar-form visible-md visible-lg search-form form-horizontal">
                   <input type="hidden" name="size" id="metacpan_search-size" value="20">
                  <div class="form-group">
                      <div class="search-group">
                        <i class="fa fa-search"></i>
                        <input type="text" name="q" placeholder="Search the CPAN" size="41" autocorrect="off" autocapitalize="off" spellcheck="false" id="metacpan_search-input" class="form-control" value="">
                      </div>
                  </div>
                </form>
                    <li class="icon-slidepanel visible-xs visible-sm">
                      <button data-toggle="slidepanel" data-target=".slidepanel">
                        <span class="button-fa-icon">
                          <i class="fa fa-bars slidepanel-open"></i>
                          <i class="fa fa-times slidepanel-close"></i>
                        </span>
                      </button>
                    </li>
                <form action="https://metacpan.org/account/logout" method="POST" id="metacpan-logout"></form>
                <li class="dropdown logged_in" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon logged-in-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="https://metacpan.org/account/identities">Identities</a></li>
                        <li><a href="https://metacpan.org/account/profile">Profile</a></li>
                        <li><a href="https://metacpan.org/account/favorite/list">Favorites</a></li>
                        <li>
                            <a href="./Win32::API.html#" type="button" onclick="$('#metacpan-logout').submit(); return false">
                              Logout
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_out" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="https://metacpan.org/login/github">
                                <i class="fab fa-github fa-fw"></i>
                                GitHub
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/twitter">
                                <i class="fab fa-twitter fa-fw"></i>
                                Twitter
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/google">
                                <i class="fab fa-google fa-fw"></i>
                                Google
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_placeholder">
                    <button>
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                    </button>
                </li>
            </ul>
        </nav>
        <div class="page-content ">
          <!--
          <div class="top-notify-banner">
            <i class="fas fa-info-circle"></i>
          </div>
          -->
          <nav class="sidebar">
            <div class="slidepanel">
              <ul class="nav-list ">
    <li class="nav-header no-margin-top">
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The date that this version of Win32-API was released.">
      <span class="relatize">21 Jan 2016 20:13:25 UTC</span>
    </li>
  <li>
    Distribution: <a href="https://metacpan.org/dist/Win32-API">Win32-API</a>
  </li>
  <li>
    Module version: 0.84
  </li>
  <li>
    <a data-keyboard-shortcut="g s" href="https://metacpan.org/dist/Win32-API/source/API.pm">Source</a>
    (<a href="https://metacpan.org/dist/Win32-API/source/API.pm?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g b" href="https://metacpan.org/dist/Win32-API/source">Browse</a>
    (<a href="https://metacpan.org/dist/Win32-API/source?raw=1">raw</a>)
  </li>
    <li>
      <a data-keyboard-shortcut="g c" href="https://metacpan.org/dist/Win32-API/changes">Changes</a>
    </li>
    <li>
      <a class="nopopup" href="https://metacpan.org/dist/Win32-API/contribute">How to Contribute</a>
    </li>
    <li>
        <a rel="noopener nofollow" data-keyboard-shortcut="g r" href="https://github.com/bulk88/perl5-win32-api">Repository</a>
    </li>
    <li>
      <a rel="noopener nofollow" data-keyboard-shortcut="g i" href="https://rt.cpan.org/Public/Dist/Display.html?Name=Win32-API">Issues</a>
      (10)
    </li>
    <li>
      <a rel="noopener nofollow" href="http://matrix.cpantesters.org/?dist=Win32-API+0.84" title="Matrix">Testers</a>
        <span title="(pass / fail / na)">(<a rel="noopener nofollow" href="https://www.cpantesters.org/distro/W/Win32-API.html?oncpan=1&amp;distmat=1&amp;version=0.84&amp;grade=2" style="color: #090">4</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/W/Win32-API.html?oncpan=1&amp;distmat=1&amp;version=0.84&amp;grade=3" style="color: #900">0</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/W/Win32-API.html?oncpan=1&amp;distmat=1&amp;version=0.84&amp;grade=4">5</a>)</span>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpants.cpanauthors.org/release/BULKDD/Win32-API-0.84">Kwalitee</a>
    </li>
    <li>
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The # people with an indexing permission on Win32-API who have released something to CPAN in the last 2 years (i.e. the # people likely able to release critical fixes in a timely manner)">
      Bus factor: 1
      </div>
    </li>
    <li>
      License: perl_5
    </li>
    <li>
      Perl: v5.0.0
    </li>
    <li class="nav-header">Activity</li>
    <li>
<div class="activity-graph">
    <img src="https://metacpan.org/dist/Win32-API/activity.svg?res=month" />
    <div class="comment">24 month</div>
</div>
    </li>
    <li class="nav-header">Tools</li>
    <li>
      <a itemprop="downloadUrl" href="https://cpan.metacpan.org/authors/id/B/BU/BULKDD/Win32/Win32-API-0.84.tar.gz">
      Download (<span itemprop="fileSize">239.44KB</span>)</a>
    </li>
    <li>
      <a href="https://explorer.metacpan.org/?url=%2Fmodule%2FBULKDD%2FWin32-API-0.84%2FAPI.pm">
        MetaCPAN Explorer
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Win32-API/permissions">
        Permissions
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Win32-API/releases.rss">
        Subscribe to distribution
      </a>
    </li>
    <li>
      <button class="btn btn-link" data-toggle="modal" data-target="#metacpan_install-instructions-dialog">
        Install Instructions
      </button>
    </li>
    <li>
      <form action="https://metacpan.org/search">
        <input type="hidden" name="q" value="dist:Win32-API">
        <input type="search" name="q" placeholder="Search distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
      </form>
    </li>
    <li>
      <form action="https://grep.metacpan.org/search">
        <input type="hidden" name="qd" value="Win32-API">
        <input type="hidden" name="source" value="metacpan">
        <input type="search" name="q" placeholder="grep distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
     </form>
    </li>
    <li class="version-jump">
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/API.pm&#39;" class="form-control tool-bar-form">
  <option disabled selected>Jump to version</option>
<option
  disabled
  value="BULKDD/Win32-API-0.84"
>0.84
  (BULKDD on 2016-01-21)</option>
<option
  
  value="ACALPINI/Win32-API-0.41"
>0.41
  (ACALPINI on 2003-03-10)</option>
<option
  
  value="ACALPINI/Win32-API-0.40"
>0.40
  (ACALPINI on 2003-03-07)</option>
<option
  
  value="ACALPINI/Win32-API-0.20"
>0.20
  (ACALPINI on 2000-10-24)</option>
<optgroup label="BackPAN">'
<option
  
  value="BULKDD/Win32-API-0.83_01"
>0.83_01 DEV
  (BULKDD on 2015-09-30)</option>
<option
  
  value="BULKDD/Win32-API-0.82"
>0.82
  (BULKDD on 2015-05-26)</option>
<option
  
  value="BULKDD/Win32-API-0.81"
>0.81
  (BULKDD on 2015-05-26)</option>
<option
  
  value="BULKDD/Win32-API-0.80_02"
>0.80_02 DEV
  (BULKDD on 2015-05-14)</option>
<option
  
  value="BULKDD/Win32-API-0.80_01"
>0.80_01 DEV
  (BULKDD on 2015-03-09)</option>
<option
  
  value="BULKDD/Win32-API-0.80"
>0.80
  (BULKDD on 2015-03-06)</option>
<option
  
  value="BULKDD/Win32-API-0.79"
>0.79
  (BULKDD on 2014-08-25)</option>
<option
  
  value="BULKDD/Win32-API-0.78_02"
>0.78_02 DEV
  (BULKDD on 2014-08-04)</option>
<option
  
  value="BULKDD/Win32-API-0.78_01"
>0.78_01 DEV
  (BULKDD on 2014-08-02)</option>
<option
  
  value="BULKDD/Win32-API-0.78"
>0.78
  (BULKDD on 2014-07-29)</option>
<option
  
  value="BULKDD/Win32-API-0.77"
>0.77
  (BULKDD on 2014-01-12)</option>
<option
  
  value="BULKDD/Win32-API-0.76_05"
>0.76_05 DEV
  (BULKDD on 2013-11-24)</option>
<option
  
  value="BULKDD/Win32-API-0.76_04"
>0.76_04 DEV
  (BULKDD on 2013-10-12)</option>
<option
  
  value="BULKDD/Win32-API-0.76_03"
>0.76_03 DEV
  (BULKDD on 2013-07-04)</option>
<option
  
  value="BULKDD/Win32-API-0.76_02"
>0.76_02 DEV
  (BULKDD on 2013-06-27)</option>
<option
  
  value="BULKDD/Win32-API-0.76_01"
>0.76_01 DEV
  (BULKDD on 2013-03-26)</option>
<option
  
  value="BULKDD/Win32-API-0.75"
>0.75
  (BULKDD on 2013-01-09)</option>
<option
  
  value="BULKDD/Win32-API-0.74"
>0.74
  (BULKDD on 2012-11-21)</option>
<option
  
  value="BULKDD/Win32-API-0.73"
>0.73
  (BULKDD on 2012-10-20)</option>
<option
  
  value="COSIMO/Win32-API-0.72"
>0.72
  (COSIMO on 2012-10-16)</option>
<option
  
  value="COSIMO/Win32-API-0.71"
>0.71
  (COSIMO on 2012-10-14)</option>
<option
  
  value="BULKDD/Win32-API-0.70_02"
>0.70_02 DEV
  (BULKDD on 2012-08-16)</option>
<option
  
  value="BULKDD/Win32-API-0.70_01"
>0.70_01 DEV
  (BULKDD on 2012-08-16)</option>
<option
  
  value="COSIMO/Win32-API-0.68"
>0.68
  (COSIMO on 2012-04-10)</option>
<option
  
  value="COSIMO/Win32-API-0.67"
>0.67
  (COSIMO on 2012-02-14)</option>
<option
  
  value="COSIMO/Win32-API-0.66"
>0.66
  (COSIMO on 2012-02-13)</option>
<option
  
  value="COSIMO/Win32-API-0.65"
>0.65
  (COSIMO on 2012-02-12)</option>
<option
  
  value="COSIMO/Win32-API-0.64"
>0.64
  (COSIMO on 2011-08-28)</option>
<option
  
  value="COSIMO/Win32-API-0.63"
>0.63
  (COSIMO on 2011-07-19)</option>
<option
  
  value="COSIMO/Win32-API-0.62"
>0.62
  (COSIMO on 2011-03-26)</option>
<option
  
  value="COSIMO/Win32-API-0.61"
>0.61
  (COSIMO on 2011-03-22)</option>
<option
  
  value="COSIMO/Win32-API-0.60"
>0.60
  (COSIMO on 2011-03-18)</option>
<option
  
  value="COSIMO/Win32-API-0.59"
>0.59
  (COSIMO on 2009-07-03)</option>
<option
  
  value="COSIMO/Win32-API-0.58"
>0.58
  (COSIMO on 2009-01-17)</option>
<option
  
  value="COSIMO/Win32-API-0.57"
>0.57
  (COSIMO on 2008-10-16)</option>
<option
  
  value="COSIMO/Win32-API-0.56"
>0.56
  (COSIMO on 2008-10-02)</option>
<option
  
  value="COSIMO/Win32-API-0.55"
>0.55
  (COSIMO on 2008-03-23)</option>
<option
  
  value="COSIMO/Win32-API-0.54"
>0.54
  (COSIMO on 2008-03-03)</option>
<option
  
  value="COSIMO/Win32-API-0.53"
>0.53
  (COSIMO on 2008-03-02)</option>
<option
  
  value="COSIMO/Win32-API-0.52"
>0.52
  (COSIMO on 2008-03-01)</option>
<option
  
  value="COSIMO/Win32-API-0.51"
>0.51
  (COSIMO on 2008-03-01)</option>
<option
  
  value="COSIMO/Win32-API-0.50"
>0.50
  (COSIMO on 2008-02-25)</option>
<option
  
  value="COSIMO/Win32-API-0.49"
>0.49
  (COSIMO on 2008-02-20)</option>
<option
  
  value="COSIMO/Win32-API-0.48"
>0.48
  (COSIMO on 2008-02-20)</option>
<option
  
  value="COSIMO/Win32-API-0.47"
>0.47
  (COSIMO on 2007-11-12)</option>
<option
  
  value="COSIMO/Win32-API-0.46"
>0.46
  (COSIMO on 2006-12-23)</option>
<option
  
  value="COSIMO/Win32-API-0.45"
>0.45
  (COSIMO on 2006-11-30)</option>
<option
  
  value="COSIMO/Win32-API-0.44"
>0.44
  (COSIMO on 2006-11-28)</option>
<option
  
  value="COSIMO/Win32-API-0.43"
>0.43
  (COSIMO on 2006-11-28)</option>
</optgroup>
</select>
    </li>
    <li class="version-diff">
<select onchange="document.location.href='/release/BULKDD/Win32-API-0.84/diff/' + encodeURIComponent(this.value) + '/API.pm'
" class="form-control tool-bar-form">
  <option disabled selected>Diff with version</option>
<option
  disabled
  value="BULKDD/Win32-API-0.84"
>0.84
  (BULKDD on 2016-01-21)</option>
<option
  
  value="ACALPINI/Win32-API-0.41"
>0.41
  (ACALPINI on 2003-03-10)</option>
<option
  
  value="ACALPINI/Win32-API-0.40"
>0.40
  (ACALPINI on 2003-03-07)</option>
<option
  
  value="ACALPINI/Win32-API-0.20"
>0.20
  (ACALPINI on 2000-10-24)</option>
<optgroup label="BackPAN">'
<option
  
  value="BULKDD/Win32-API-0.83_01"
>0.83_01 DEV
  (BULKDD on 2015-09-30)</option>
<option
  
  value="BULKDD/Win32-API-0.82"
>0.82
  (BULKDD on 2015-05-26)</option>
<option
  
  value="BULKDD/Win32-API-0.81"
>0.81
  (BULKDD on 2015-05-26)</option>
<option
  
  value="BULKDD/Win32-API-0.80_02"
>0.80_02 DEV
  (BULKDD on 2015-05-14)</option>
<option
  
  value="BULKDD/Win32-API-0.80_01"
>0.80_01 DEV
  (BULKDD on 2015-03-09)</option>
<option
  
  value="BULKDD/Win32-API-0.80"
>0.80
  (BULKDD on 2015-03-06)</option>
<option
  
  value="BULKDD/Win32-API-0.79"
>0.79
  (BULKDD on 2014-08-25)</option>
<option
  
  value="BULKDD/Win32-API-0.78_02"
>0.78_02 DEV
  (BULKDD on 2014-08-04)</option>
<option
  
  value="BULKDD/Win32-API-0.78_01"
>0.78_01 DEV
  (BULKDD on 2014-08-02)</option>
<option
  
  value="BULKDD/Win32-API-0.78"
>0.78
  (BULKDD on 2014-07-29)</option>
<option
  
  value="BULKDD/Win32-API-0.77"
>0.77
  (BULKDD on 2014-01-12)</option>
<option
  
  value="BULKDD/Win32-API-0.76_05"
>0.76_05 DEV
  (BULKDD on 2013-11-24)</option>
<option
  
  value="BULKDD/Win32-API-0.76_04"
>0.76_04 DEV
  (BULKDD on 2013-10-12)</option>
<option
  
  value="BULKDD/Win32-API-0.76_03"
>0.76_03 DEV
  (BULKDD on 2013-07-04)</option>
<option
  
  value="BULKDD/Win32-API-0.76_02"
>0.76_02 DEV
  (BULKDD on 2013-06-27)</option>
<option
  
  value="BULKDD/Win32-API-0.76_01"
>0.76_01 DEV
  (BULKDD on 2013-03-26)</option>
<option
  
  value="BULKDD/Win32-API-0.75"
>0.75
  (BULKDD on 2013-01-09)</option>
<option
  
  value="BULKDD/Win32-API-0.74"
>0.74
  (BULKDD on 2012-11-21)</option>
<option
  
  value="BULKDD/Win32-API-0.73"
>0.73
  (BULKDD on 2012-10-20)</option>
<option
  
  value="COSIMO/Win32-API-0.72"
>0.72
  (COSIMO on 2012-10-16)</option>
<option
  
  value="COSIMO/Win32-API-0.71"
>0.71
  (COSIMO on 2012-10-14)</option>
<option
  
  value="BULKDD/Win32-API-0.70_02"
>0.70_02 DEV
  (BULKDD on 2012-08-16)</option>
<option
  
  value="BULKDD/Win32-API-0.70_01"
>0.70_01 DEV
  (BULKDD on 2012-08-16)</option>
<option
  
  value="COSIMO/Win32-API-0.68"
>0.68
  (COSIMO on 2012-04-10)</option>
<option
  
  value="COSIMO/Win32-API-0.67"
>0.67
  (COSIMO on 2012-02-14)</option>
<option
  
  value="COSIMO/Win32-API-0.66"
>0.66
  (COSIMO on 2012-02-13)</option>
<option
  
  value="COSIMO/Win32-API-0.65"
>0.65
  (COSIMO on 2012-02-12)</option>
<option
  
  value="COSIMO/Win32-API-0.64"
>0.64
  (COSIMO on 2011-08-28)</option>
<option
  
  value="COSIMO/Win32-API-0.63"
>0.63
  (COSIMO on 2011-07-19)</option>
<option
  
  value="COSIMO/Win32-API-0.62"
>0.62
  (COSIMO on 2011-03-26)</option>
<option
  
  value="COSIMO/Win32-API-0.61"
>0.61
  (COSIMO on 2011-03-22)</option>
<option
  
  value="COSIMO/Win32-API-0.60"
>0.60
  (COSIMO on 2011-03-18)</option>
<option
  
  value="COSIMO/Win32-API-0.59"
>0.59
  (COSIMO on 2009-07-03)</option>
<option
  
  value="COSIMO/Win32-API-0.58"
>0.58
  (COSIMO on 2009-01-17)</option>
<option
  
  value="COSIMO/Win32-API-0.57"
>0.57
  (COSIMO on 2008-10-16)</option>
<option
  
  value="COSIMO/Win32-API-0.56"
>0.56
  (COSIMO on 2008-10-02)</option>
<option
  
  value="COSIMO/Win32-API-0.55"
>0.55
  (COSIMO on 2008-03-23)</option>
<option
  
  value="COSIMO/Win32-API-0.54"
>0.54
  (COSIMO on 2008-03-03)</option>
<option
  
  value="COSIMO/Win32-API-0.53"
>0.53
  (COSIMO on 2008-03-02)</option>
<option
  
  value="COSIMO/Win32-API-0.52"
>0.52
  (COSIMO on 2008-03-01)</option>
<option
  
  value="COSIMO/Win32-API-0.51"
>0.51
  (COSIMO on 2008-03-01)</option>
<option
  
  value="COSIMO/Win32-API-0.50"
>0.50
  (COSIMO on 2008-02-25)</option>
<option
  
  value="COSIMO/Win32-API-0.49"
>0.49
  (COSIMO on 2008-02-20)</option>
<option
  
  value="COSIMO/Win32-API-0.48"
>0.48
  (COSIMO on 2008-02-20)</option>
<option
  
  value="COSIMO/Win32-API-0.47"
>0.47
  (COSIMO on 2007-11-12)</option>
<option
  
  value="COSIMO/Win32-API-0.46"
>0.46
  (COSIMO on 2006-12-23)</option>
<option
  
  value="COSIMO/Win32-API-0.45"
>0.45
  (COSIMO on 2006-11-30)</option>
<option
  
  value="COSIMO/Win32-API-0.44"
>0.44
  (COSIMO on 2006-11-28)</option>
<option
  
  value="COSIMO/Win32-API-0.43"
>0.43
  (COSIMO on 2006-11-28)</option>
</optgroup>
</select>
    </li>

    <li>
<ul class="dependencies">
  <li class="nav-header">Dependencies</li>
  <li><a href="https://metacpan.org/pod/Scalar::Util" title="Scalar::Util" class="ellipsis">Scalar::Util</a></li>
  <li><i class="ttip" title="dynamic_config enabled">and possibly others</i></li>
  <li>
    <hr>
  </li>
  <li>
    <a href="https://metacpan.org/module/Win32::API/requires">Reverse dependencies</a>
  </li>
  <li>
    <a href="http://deps.cpantesters.org/?module=Win32%3A%3AAPI">CPAN Testers List</a>
  </li>
  <li>
    <a href="https://cpandeps.grinnz.com/?dist=Win32-API">Dependency graph</a>
  </li>
</ul>
    </li>
    <li class="nav-header">Permalinks</li>
    <li>
      <a href="https://metacpan.org/release/BULKDD/Win32-API-0.84/view/API.pm">This version</a>
    </li>
    <li>
      <a href="./Win32::API.html">Latest version</a>
    </li>
    <li>
<div class="plussers">
<div class="nav-header">++ed by:</div>
<div>
<a class="display-all" href="https://metacpan.org/author/SALVA"><img src="https://www.gravatar.com/avatar/026f1493e8fcd16015467901fa76e9ec?d=identicon&amp;s=20" title="SALVA" alt="SALVA"></a>
<a class="display-all" href="https://metacpan.org/author/PINGAN"><img src="https://www.gravatar.com/avatar/a02222e5e0e4fd24d52fc29a08ac6bcb?d=identicon&amp;s=20" title="PINGAN" alt="PINGAN"></a>
<a class="display-all" href="https://metacpan.org/author/MOB"><img src="https://www.gravatar.com/avatar/46b032a55fdf8a39e6971f12887f0ac8?d=identicon&amp;s=20" title="MOB" alt="MOB"></a>
<a class="display-all" href="https://metacpan.org/author/XLAT"><img src="https://www.gravatar.com/avatar/a477fe9cd31dd7f08e1962deff6ef5c5?d=identicon&amp;s=20" title="XLAT" alt="XLAT"></a>
<a class="display-all" href="https://metacpan.org/author/KEEDI"><img src="https://www.gravatar.com/avatar/95f905a7a4ccc573c711e9d264c0fde8?d=identicon&amp;s=20" title="KEEDI" alt="KEEDI"></a>
</div>
<!-- Display counts of plussers-->
<div>
    <a href="https://metacpan.org/dist/Win32-API/plussers">5 PAUSE users</a>
</div>
<div>
    4 non-PAUSE users
</div>
</div>
    </li>
    <li>
<div id="metacpan_contributors">
  <div>
    <button class="btn-link"
      onclick="$(this).hide(); $('#metacpan_contributors ul').slideDown(); return false;"
    >and 1 contributors</button>
  </div>
  <ul style="display: none">
    <li class="contributor"
      data-cpan-author="ACALPINI"
      data-contrib-email="dada@perl.it"
    >
      <a href="https://metacpan.org/author/ACALPINI" class="cpan-author">
      <img class="gravatar" width="20" height="20" src="https://www.gravatar.com/avatar/b6e8656226999389e5098d10e00226fe?d=identicon&amp;s=20" />
      Aldo Calpini, Cosimo Streppone &lt;cosimo@cpan.org&gt;, Daniel Dragan &lt;bulkdd@cpan.org&gt;
      </a>
    </li>
  </ul>
</div>
    </li>
              </ul>
            </div>
          </nav>
          <div class="content-navigation">
<div class="breadcrumbs">
  <span>
    <a data-keyboard-shortcut="g a" rel="author" href="https://metacpan.org/author/BULKDD" class="author-name">Daniel Dragan</a>
  </span>
  <span>&nbsp;/&nbsp;</span>
  <div class="release dist-release status-latest maturity-released">
    <span class="dropdown"><b class="caret"></b></span>
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/API.pm&#39;" class="">
<option
  selected
  value="BULKDD/Win32-API-0.84"
>0.84
  (BULKDD on 2016-01-21)</option>
<option
  
  value="ACALPINI/Win32-API-0.41"
>0.41
  (ACALPINI on 2003-03-10)</option>
<option
  
  value="ACALPINI/Win32-API-0.40"
>0.40
  (ACALPINI on 2003-03-07)</option>
<option
  
  value="ACALPINI/Win32-API-0.20"
>0.20
  (ACALPINI on 2000-10-24)</option>
<optgroup label="BackPAN">'
<option
  
  value="BULKDD/Win32-API-0.83_01"
>0.83_01 DEV
  (BULKDD on 2015-09-30)</option>
<option
  
  value="BULKDD/Win32-API-0.82"
>0.82
  (BULKDD on 2015-05-26)</option>
<option
  
  value="BULKDD/Win32-API-0.81"
>0.81
  (BULKDD on 2015-05-26)</option>
<option
  
  value="BULKDD/Win32-API-0.80_02"
>0.80_02 DEV
  (BULKDD on 2015-05-14)</option>
<option
  
  value="BULKDD/Win32-API-0.80_01"
>0.80_01 DEV
  (BULKDD on 2015-03-09)</option>
<option
  
  value="BULKDD/Win32-API-0.80"
>0.80
  (BULKDD on 2015-03-06)</option>
<option
  
  value="BULKDD/Win32-API-0.79"
>0.79
  (BULKDD on 2014-08-25)</option>
<option
  
  value="BULKDD/Win32-API-0.78_02"
>0.78_02 DEV
  (BULKDD on 2014-08-04)</option>
<option
  
  value="BULKDD/Win32-API-0.78_01"
>0.78_01 DEV
  (BULKDD on 2014-08-02)</option>
<option
  
  value="BULKDD/Win32-API-0.78"
>0.78
  (BULKDD on 2014-07-29)</option>
<option
  
  value="BULKDD/Win32-API-0.77"
>0.77
  (BULKDD on 2014-01-12)</option>
<option
  
  value="BULKDD/Win32-API-0.76_05"
>0.76_05 DEV
  (BULKDD on 2013-11-24)</option>
<option
  
  value="BULKDD/Win32-API-0.76_04"
>0.76_04 DEV
  (BULKDD on 2013-10-12)</option>
<option
  
  value="BULKDD/Win32-API-0.76_03"
>0.76_03 DEV
  (BULKDD on 2013-07-04)</option>
<option
  
  value="BULKDD/Win32-API-0.76_02"
>0.76_02 DEV
  (BULKDD on 2013-06-27)</option>
<option
  
  value="BULKDD/Win32-API-0.76_01"
>0.76_01 DEV
  (BULKDD on 2013-03-26)</option>
<option
  
  value="BULKDD/Win32-API-0.75"
>0.75
  (BULKDD on 2013-01-09)</option>
<option
  
  value="BULKDD/Win32-API-0.74"
>0.74
  (BULKDD on 2012-11-21)</option>
<option
  
  value="BULKDD/Win32-API-0.73"
>0.73
  (BULKDD on 2012-10-20)</option>
<option
  
  value="COSIMO/Win32-API-0.72"
>0.72
  (COSIMO on 2012-10-16)</option>
<option
  
  value="COSIMO/Win32-API-0.71"
>0.71
  (COSIMO on 2012-10-14)</option>
<option
  
  value="BULKDD/Win32-API-0.70_02"
>0.70_02 DEV
  (BULKDD on 2012-08-16)</option>
<option
  
  value="BULKDD/Win32-API-0.70_01"
>0.70_01 DEV
  (BULKDD on 2012-08-16)</option>
<option
  
  value="COSIMO/Win32-API-0.68"
>0.68
  (COSIMO on 2012-04-10)</option>
<option
  
  value="COSIMO/Win32-API-0.67"
>0.67
  (COSIMO on 2012-02-14)</option>
<option
  
  value="COSIMO/Win32-API-0.66"
>0.66
  (COSIMO on 2012-02-13)</option>
<option
  
  value="COSIMO/Win32-API-0.65"
>0.65
  (COSIMO on 2012-02-12)</option>
<option
  
  value="COSIMO/Win32-API-0.64"
>0.64
  (COSIMO on 2011-08-28)</option>
<option
  
  value="COSIMO/Win32-API-0.63"
>0.63
  (COSIMO on 2011-07-19)</option>
<option
  
  value="COSIMO/Win32-API-0.62"
>0.62
  (COSIMO on 2011-03-26)</option>
<option
  
  value="COSIMO/Win32-API-0.61"
>0.61
  (COSIMO on 2011-03-22)</option>
<option
  
  value="COSIMO/Win32-API-0.60"
>0.60
  (COSIMO on 2011-03-18)</option>
<option
  
  value="COSIMO/Win32-API-0.59"
>0.59
  (COSIMO on 2009-07-03)</option>
<option
  
  value="COSIMO/Win32-API-0.58"
>0.58
  (COSIMO on 2009-01-17)</option>
<option
  
  value="COSIMO/Win32-API-0.57"
>0.57
  (COSIMO on 2008-10-16)</option>
<option
  
  value="COSIMO/Win32-API-0.56"
>0.56
  (COSIMO on 2008-10-02)</option>
<option
  
  value="COSIMO/Win32-API-0.55"
>0.55
  (COSIMO on 2008-03-23)</option>
<option
  
  value="COSIMO/Win32-API-0.54"
>0.54
  (COSIMO on 2008-03-03)</option>
<option
  
  value="COSIMO/Win32-API-0.53"
>0.53
  (COSIMO on 2008-03-02)</option>
<option
  
  value="COSIMO/Win32-API-0.52"
>0.52
  (COSIMO on 2008-03-01)</option>
<option
  
  value="COSIMO/Win32-API-0.51"
>0.51
  (COSIMO on 2008-03-01)</option>
<option
  
  value="COSIMO/Win32-API-0.50"
>0.50
  (COSIMO on 2008-02-25)</option>
<option
  
  value="COSIMO/Win32-API-0.49"
>0.49
  (COSIMO on 2008-02-20)</option>
<option
  
  value="COSIMO/Win32-API-0.48"
>0.48
  (COSIMO on 2008-02-20)</option>
<option
  
  value="COSIMO/Win32-API-0.47"
>0.47
  (COSIMO on 2007-11-12)</option>
<option
  
  value="COSIMO/Win32-API-0.46"
>0.46
  (COSIMO on 2006-12-23)</option>
<option
  
  value="COSIMO/Win32-API-0.45"
>0.45
  (COSIMO on 2006-11-30)</option>
<option
  
  value="COSIMO/Win32-API-0.44"
>0.44
  (COSIMO on 2006-11-28)</option>
<option
  
  value="COSIMO/Win32-API-0.43"
>0.43
  (COSIMO on 2006-11-28)</option>
</optgroup>
</select>
    <a data-keyboard-shortcut="g d" class="release-name" href="https://metacpan.org/dist/Win32-API">Win32-API-0.84</a>
  </div>
<span class="river-gauge-gauge">
  <svg width="24px"
       height="15px"
       version="1.1"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:xlink="http://www.w3.org/1999/xlink">

    <g>
      <title>        River stage two &#10;
          • 30 direct dependents &#10;          • 34 total dependents
      </title>

      <rect x="0"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="5"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="10"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="15"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="20"  y="0" width="4" height="15" fill="#e4e2e2" />
    </g>
  </svg>

</span>
<div id="Win32-API-fav" class="logged_in">
<form action="https://metacpan.org/account/favorite/add" style="display: inline" onsubmit="return favDistribution(this)">
    <input type="hidden" name="remove" value="0">
    <input type="hidden" name="release" value="Win32-API-0.84">
    <input type="hidden" name="author" value="BULKDD">
    <input type="hidden" name="distribution" value="Win32-API">
    <button type="submit" class="favorite highlight"><span>9</span> ++</button>
</form>
</div>
<div class="logged_out">
<a href="./Win32::API.html" onclick="alert('Please sign in to add favorites'); return false" class="favorite highlight">
<span>9</span> ++</a>
</div>
   / <span>Win32::API</span>
</div>
          </div>
          <main class="content">


<nav class="toc">
  <div class="toc-header"><strong>Contents</strong></div>
<ul>
  <li><a href="./Win32::API.html#NAME">NAME</a></li>
  <li><a href="./Win32::API.html#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="./Win32::API.html#ABSTRACT">ABSTRACT</a></li>
  <li><a href="./Win32::API.html#DESCRIPTION">DESCRIPTION</a>
    <ul>
      <li><a href="./Win32::API.html#IMPORTING-A-FUNCTION">IMPORTING A FUNCTION</a></li>
      <li><a href="./Win32::API.html#IMPORTING-A-FUNCTION-BY-PROTOTYPE">IMPORTING A FUNCTION BY PROTOTYPE</a></li>
      <li><a href="./Win32::API.html#IMPORTING-A-FUNCTION-WITH-A-PARAMETER-LIST">IMPORTING A FUNCTION WITH A PARAMETER LIST</a></li>
      <li><a href="./Win32::API.html#CALLING-AN-IMPORTED-FUNCTION">CALLING AN IMPORTED FUNCTION</a></li>
      <li><a href="./Win32::API.html#USING-STRUCTURES">USING STRUCTURES</a></li>
      <li><a href="./Win32::API.html#EXPORTED-FUNCTIONS">EXPORTED FUNCTIONS</a>
        <ul>
          <li><a href="./Win32::API.html#ReadMemory">ReadMemory</a></li>
          <li><a href="./Win32::API.html#WriteMemory">WriteMemory</a></li>
          <li><a href="./Win32::API.html#MoveMemory">MoveMemory</a></li>
          <li><a href="./Win32::API.html#IsBadReadPtr">IsBadReadPtr</a></li>
          <li><a href="./Win32::API.html#SafeReadWideCString">SafeReadWideCString</a></li>
        </ul>
      </li>
      <li><a href="./Win32::API.html#CONSTRUCTORS">CONSTRUCTORS</a>
        <ul>
          <li><a href="./Win32::API.html#new">new</a></li>
          <li><a href="./Win32::API.html#Import-$obj-=-Win32::API::More-%3EImport(%5B$dllname-%7C-(undef-,-$funcptr)%5D,-%5B$c_proto-%7C-($in,-$out-%5B,-$calling_convention%5D)%5D);">Import $obj = Win32::API::More-&gt;Import([$dllname | (undef , $funcptr)], [$c_proto | ($in, $out [, $calling_convention])]);</a></li>
        </ul>
      </li>
      <li><a href="./Win32::API.html#METHODS">METHODS</a>
        <ul>
          <li><a href="./Win32::API.html#Call">Call</a></li>
          <li><a href="./Win32::API.html#UseMI64">UseMI64</a></li>
        </ul>
      </li>
      <li><a href="./Win32::API.html#VERBOSE-DEBUGGING">VERBOSE DEBUGGING</a></li>
    </ul>
  </li>
  <li><a href="./Win32::API.html#HISTORY">HISTORY</a></li>
  <li><a href="./Win32::API.html#BUGS-AND-LIMITATIONS">BUGS AND LIMITATIONS</a></li>
  <li><a href="./Win32::API.html#SEE-ALSO">SEE ALSO</a></li>
  <li><a href="./Win32::API.html#AUTHOR">AUTHOR</a></li>
  <li><a href="./Win32::API.html#MAINTAINER">MAINTAINER</a></li>
  <li><a href="./Win32::API.html#MAJOR-CONTRIBUTOR">MAJOR CONTRIBUTOR</a></li>
  <li><a href="./Win32::API.html#LICENSE">LICENSE</a></li>
  <li><a href="./Win32::API.html#CREDITS">CREDITS</a></li>
</ul></nav>
<div class="pod anchors">
<h1 id="NAME">NAME</h1>

<p>Win32::API - Perl Win32 API Import Facility</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code>  #### Method 1: with prototype

  use Win32::API;
  $function = Win32::API::More-&gt;new(
      &#39;mydll&#39;, &#39;int sum_integers(int a, int b)&#39;
  );
  #### $^E is non-Cygwin only
  die &quot;Error: $^E&quot; if ! $function;
  #### or on Cygwin and non-Cygwin
  die &quot;Error: &quot;.(Win32::FormatMessage(Win32::GetLastError())) if ! $function;
  ####
  $return = $function-&gt;Call(3, 2);

  #### Method 2: with prototype and your function pointer

  use Win32::API;
  $function = Win32::API::More-&gt;new(
      undef, 38123456, &#39;int name_ignored(int a, int b)&#39;
  );
  die &quot;Error: $^E&quot; if ! $function; #$^E is non-Cygwin only
  $return = $function-&gt;Call(3, 2);

  #### Method 3: with parameter list 
  
  use Win32::API;
  $function = Win32::API::More-&gt;new(
      &#39;mydll&#39;, &#39;sum_integers&#39;, &#39;II&#39;, &#39;I&#39;
  );
  die &quot;Error: $^E&quot; if ! $function; #$^E is non-Cygwin only
  $return = $function-&gt;Call(3, 2);
     
  #### Method 4: with parameter list and your function pointer
  
  use Win32::API;
  $function = Win32::API::More-&gt;new(
      undef, 38123456, &#39;name_ignored&#39;, &#39;II&#39;, &#39;I&#39;
  );
  die &quot;Error: $^E&quot; if ! $function; #$^E is non-Cygwin only
  $return = $function-&gt;Call(3, 2);
  
  #### Method 5: with Import (slightly faster than -&gt;Call)
 
  use Win32::API;
  $function = Win32::API::More-&gt;Import(
      &#39;mydll&#39;, &#39;int sum_integers(int a, int b)&#39;
  );
  die &quot;Error: $^E&quot; if ! $function; #$^E is non-Cygwin only
  $return = sum_integers(3, 2);</code></pre>

<h1 id="ABSTRACT">ABSTRACT</h1>

<p>With this module you can import and call arbitrary functions from Win32&#39;s Dynamic Link Libraries (DLL) or arbitrary functions for which you have a pointer (MS COM, etc), without having to write an XS extension. Note, however, that this module can&#39;t do everything. In fact, parameters input and output is limited to simpler cases.</p>

<p>A regular <b>XS</b> extension is always safer and faster anyway.</p>

<p>The current version of Win32::API is always available at your nearest CPAN mirror:</p>

<pre><code>  http://search.cpan.org/dist/Win32-API/</code></pre>

<p>A short example of how you can use this module (it just gets the PID of the current process, eg. same as Perl&#39;s internal <code>$$</code>):</p>

<pre><code>    use Win32::API;
    Win32::API::More-&gt;Import(&quot;kernel32&quot;, &quot;int GetCurrentProcessId()&quot;);
    $PID = GetCurrentProcessId();</code></pre>

<p>Starting with 0.69. Win32::API initiated objects are deprecated due to numerous bugs and improvements, use Win32::API::More now. The use statement remains as <code>use Win32::API;</code>.</p>

<p>The possibilities are nearly infinite (but not all are good :-). Enjoy it.</p>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>To use this module put the following line at the beginning of your script:</p>

<pre><code>    use Win32::API;</code></pre>

<p>You can now use the <code>new()</code> function of the Win32::API module to create a new Win32::API::More object (see <a href="./Win32::API.html#IMPORTING-A-FUNCTION">&quot;IMPORTING A FUNCTION&quot;</a>) and then invoke the <code>Call()</code> method on this object to perform a call to the imported API (see <a href="./Win32::API.html#CALLING-AN-IMPORTED-FUNCTION">&quot;CALLING AN IMPORTED FUNCTION&quot;</a>).</p>

<p>Starting from version 0.40, you can also avoid creating a Win32::API::More object and instead automatically define a Perl sub with the same name of the API function you&#39;re importing. This 2nd way using <code>Import</code> to create a sub instead of an object is slightly faster than doing <code>-&gt;Call()</code>. The details of the API definitions are the same, just the method name is different:</p>

<pre><code>    my $GetCurrentProcessId = Win32::API::More-&gt;new(
        &quot;kernel32&quot;, &quot;int GetCurrentProcessId()&quot;
    );
    die &quot;Failed to import GetCurrentProcessId&quot; if !$GetCurrentProcessId;
    $GetCurrentProcessId-&gt;UseMI64(1);
    my $PID = $GetCurrentProcessId-&gt;Call();

    #### vs.

    my $UnusedGCPI = Win32::API::More-&gt;Import(&quot;kernel32&quot;, &quot;int GetCurrentProcessId()&quot;);
    die &quot;Failed to import GetCurrentProcessId&quot; if !$UnusedGCPI;
    $UnusedGCPI-&gt;UseMI64(1);
    $PID = GetCurrentProcessId();</code></pre>

<p>Note that <code>Import</code> returns the Win32::API obj on success and false on failure (in which case you can check the content of <code>$^E</code>). This allows some settings to be set through method calls that can&#39;t be specified as a parameter to Import, yet still have the convience of not writing <code>-&gt;Call()</code>. The Win32::API obj does not need to be assigned to a scalar. <code>unless(Win32::API::More-&gt;Import</code> is fine. Prior to v0.76_02, <code>Import</code> returned returned 1 on success and 0 on failure.</p>

<h2 id="IMPORTING-A-FUNCTION"><a id="IMPORTING"></a>IMPORTING A FUNCTION</h2>

<p>You can import a function from a 32 bit Dynamic Link Library (DLL) file with the <code>new()</code> function or, starting in 0.69, supply your own function pointer. This will create a Perl object that contains the reference to that function, which you can later <code>Call()</code>.</p>

<p>What you need to know is the prototype of the function you&#39;re going to import (eg. the definition of the function expressed in C syntax).</p>

<p>Starting from version 0.40, there are 2 different approaches for this step: (the preferred) one uses the prototype directly, while the other (now deprecated) one uses Win32::API&#39;s internal representation for parameters.</p>

<h2 id="IMPORTING-A-FUNCTION-BY-PROTOTYPE"><a id="IMPORTING1"></a>IMPORTING A FUNCTION BY PROTOTYPE</h2>

<p>You need to pass 2 or 3 parameters:</p>

<ol>

<li><p>The name of the library from which you want to import the function. If the name is undef, you are requesting a object created from a function pointer, and must supply item 2.</p>

</li>
<li><p>This parameter is optional, most people should skip it, skip does not mean supplying undef. Supply a function pointer in the format of number 1234, not string &quot;\x01\x02\x03\x04&quot;. Undef will be returned if the pointer is not readable, <a href="https://metacpan.org/pod/Win32#Win32::GetLastError()">Win32::GetLastError</a>/<a href="variables/$&lt;digits&gt;-($1,-$2,-...).html#$%5EE">&quot;$^E&quot; in perlvar</a> will be <code>ERROR_NOACCESS</code>.</p>

</li>
<li><p>The C prototype of the function. If you are using a function pointer, the name of the function should be something &quot;friendly&quot; to you and no attempt is made to retrieve such a name from any DLL&#39;s export table. This name for a function pointer is also used for Import().</p>

</li>
</ol>

<p>When calling a function imported with a prototype, if you pass an undefined Perl scalar to one of its arguments, it will be automatically turned into a C <code>NULL</code> value.</p>

<p>See <a href="https://metacpan.org/pod/Win32::API::Type">Win32::API::Type</a> for a list of the known parameter types and <a href="https://metacpan.org/pod/Win32::API::Struct">Win32::API::Struct</a> for information on how to define a structure.</p>

<p>If a prototype type is exactly <code>signed char</code> or <code>unsigned char</code> for an &quot;in&quot; parameter or the return parameter, and for &quot;in&quot; parameters only <code>signed char *</code> or <code>unsigned char *</code> the parameters will be treated as a number, <code>0x01</code>, not <code>&quot;\x01&quot;</code>. &quot;UCHAR&quot; is not &quot;unsigned char&quot;. Change the C prototype if you want numeric handling for your chars.</p>

<h2 id="IMPORTING-A-FUNCTION-WITH-A-PARAMETER-LIST"><a id="IMPORTING2"></a>IMPORTING A FUNCTION WITH A PARAMETER LIST</h2>

<p>You need to pass at minimum 4 parameters.</p>

<dl>

<dt id="1.-The-name-of-the-library-from-which-you-want-to-import-the-function."><a id="1"></a><a id="The-name-of-the-library-from-which-you-want-to-import-the-function"></a>1. The name of the library from which you want to import the function.</dt>
<dd>

</dd>
<dt id="2.-This-parameter-is-optional,-most-people-should-skip-it,-skip-does-not-mean-supplying-undef.-Supply-a-function-pointer-in-the-format-of-number-1234,-not-string-&quot;\x01\x02\x03\x04&quot;.-Undef-will-be-returned-if-the-pointer-is-not-readable,-Win32::GetLastError/&quot;$^E&quot;-in-perlvar-will-be-ERROR_NOACCESS."><a id="2"></a><a id="This-parameter-is-optional--most-people-should-skip-it--skip-does-not-mean-supplying-undef.-Supply-a-function-pointer-in-the-format-of-number-1234--not-string--x01-x02-x03-x04-.-Undef-will-be-returned-if-the-pointer-is-not-readable--Win32::GetLastError-E--in-perlvar-will-be-ERROR_NOACCESS"></a>2. This parameter is optional, most people should skip it, skip does not mean supplying undef. Supply a function pointer in the format of number <code>1234</code>, not string <code>&quot;\x01\x02\x03\x04&quot;</code>. Undef will be returned if the pointer is not readable, <a href="https://metacpan.org/pod/Win32#Win32::GetLastError()">Win32::GetLastError</a>/<a href="variables/$&lt;digits&gt;-($1,-$2,-...).html#$%5EE">&quot;$^E&quot; in perlvar</a> will be <code>ERROR_NOACCESS</code>.</dt>
<dd>

</dd>
<dt id="3.-The-name-of-the-function-(as-exported-by-the-library)-or-for-function-pointers-a-name-that-is-&quot;friendly&quot;-to-you.-This-name-for-a-function-pointer-is-also-used-for-Import().-No-attempt-is-made-to-retrieve-such-a-name-from-any-DLL&#39;s-export-table-in-the-2nd-case."><a id="3"></a><a id="The-name-of-the-function--as-exported-by-the-library--or-for-function-pointers-a-name-that-is--friendly--to-you.-This-name-for-a-function-pointer-is-also-used-for-Import-.-No-attempt-is-made-to-retrieve-such-a-name-from-any-DLL-s-export-table-in-the-2nd-case"></a>3. The name of the function (as exported by the library) or for function pointers a name that is &quot;friendly&quot; to you. This name for a function pointer is also used for Import(). No attempt is made to retrieve such a name from any DLL&#39;s export table in the 2nd case.</dt>
<dd>

</dd>
<dt id="4.-The-number-and-types-of-the-arguments-the-function-expects-as-input."><a id="4"></a><a id="The-number-and-types-of-the-arguments-the-function-expects-as-input"></a>4. The number and types of the arguments the function expects as input.</dt>
<dd>

</dd>
<dt id="5.-The-type-of-the-value-returned-by-the-function."><a id="5"></a><a id="The-type-of-the-value-returned-by-the-function"></a>5. The type of the value returned by the function.</dt>
<dd>

</dd>
<dt id="6.-And-optionally-you-can-specify-the-calling-convention,-this-defaults-to-&#39;__stdcall&#39;,-alternatively-you-can-specify-&#39;_cdecl&#39;-or-&#39;__cdecl&#39;-(API-&gt;-v0.68)-or-(API-&gt;-v0.70_02)-&#39;WINAPI&#39;,-&#39;NTAPI&#39;,-&#39;CALLBACK&#39;-(__stdcall),-&#39;WINAPIV&#39;-(__cdecl)-.-False-is-__stdcall.-Vararg-functions-are-always-cdecl.-MS-DLLs-are-typically-stdcall.-Non-MS-DLLs-are-typically-cdecl.-If-API-&gt;-v0.75,-mixing-up-the-calling-convention-on-32-bits-is-detected-and-Perl-will-croak-an-error-message-and-die."><a id="6"></a><a id="And-optionally-you-can-specify-the-calling-convention--this-defaults-to--__stdcall--alternatively-you-can-specify--_cdecl--or--__cdecl---API---v0.68--or--API---v0.70_02---WINAPI---NTAPI---CALLBACK---__stdcall---WINAPIV---__cdecl--.-False-is-__stdcall.-Vararg-functions-are-always-cdecl.-MS-DLLs-are-typically-stdcall.-Non-MS-DLLs-are-typically-cdecl.-If-API---v0.75--mixing-up-the-calling-convention-on-32-bits-is-detected-and-Perl-will-croak-an-error-message-and-die"></a>6. And optionally you can specify the calling convention, this defaults to &#39;__stdcall&#39;, alternatively you can specify &#39;_cdecl&#39; or &#39;__cdecl&#39; (API &gt; v0.68) or (API &gt; v0.70_02) &#39;WINAPI&#39;, &#39;NTAPI&#39;, &#39;CALLBACK&#39; (__stdcall), &#39;WINAPIV&#39; (__cdecl) . False is __stdcall. Vararg functions are always cdecl. MS DLLs are typically stdcall. Non-MS DLLs are typically cdecl. If API &gt; v0.75, mixing up the calling convention on 32 bits is detected and Perl will <code>croak</code> an error message and <code>die</code>.</dt>
<dd>

</dd>
</dl>

<p>To better explain their meaning, let&#39;s suppose that we want to import and call the Win32 API <code>GetTempPath()</code>. This function is defined in C as:</p>

<pre><code>    DWORD WINAPI GetTempPathA( DWORD nBufferLength, LPSTR lpBuffer );</code></pre>

<p>This is documented in the <b>Win32 SDK Reference</b>; you can look for it on the Microsoft&#39;s WWW site, or in your C compiler&#39;s documentation, if you own one.</p>

<dl>

<dt id="1."><a id="11"></a><a id="pod"></a><b>1.</b></dt>
<dd>

<p>The first parameter is the name of the library file that exports this function; our function resides in the <i>KERNEL32.DLL</i> system file.</p>

<p>When specifying this name as parameter, the <i>.DLL</i> extension is implicit, and if no path is given, the file is searched through a couple of directories, including:</p>

<dl>

<dt id="1.-The-directory-from-which-the-application-loaded."><a id="12"></a><a id="The-directory-from-which-the-application-loaded"></a>1. The directory from which the application loaded.</dt>
<dd>

</dd>
<dt id="2.-The-current-directory."><a id="21"></a><a id="The-current-directory"></a>2. The current directory.</dt>
<dd>

</dd>
<dt id="3.-The-Windows-system-directory-(eg.-c:\windows\system-or-system32)."><a id="31"></a><a id="The-Windows-system-directory--eg.-c:-windows-system-or-system32"></a>3. The Windows system directory (eg. c:\windows\system or system32).</dt>
<dd>

</dd>
<dt id="4.-The-Windows-directory-(eg.-c:\windows)."><a id="41"></a><a id="The-Windows-directory--eg.-c:-windows"></a>4. The Windows directory (eg. c:\windows).</dt>
<dd>

</dd>
<dt id="5.-The-directories-that-are-listed-in-the-PATH-environment-variable."><a id="51"></a><a id="The-directories-that-are-listed-in-the-PATH-environment-variable"></a>5. The directories that are listed in the PATH environment variable.</dt>
<dd>

</dd>
</dl>

<p>You may, but don&#39;t have to write <i>C:\windows\system\kernel32.dll</i>; or <i>kernel32.dll</i>, only <i>kernel32</i> is enough:</p>

<pre><code>    $GetTempPath = new Win32::API::More(&#39;kernel32&#39;, ...</code></pre>

</dd>
<dt id="2."><a id="22"></a><a id="pod1"></a><b>2.</b></dt>
<dd>

<p>Since this function is from a DLL, skip the 2nd parameter. Skip does not mean supplying undef.</p>

</dd>
<dt id="3."><a id="32"></a><a id="pod2"></a><b>3.</b></dt>
<dd>

<p>Now for the real second parameter: the name of the function. It must be written exactly as it is exported by the library (case is significant here). If you are using Windows 95 or NT 4.0, you can use the <b>Quick View</b> command on the DLL file to see the function it exports. Remember that you can only import functions from 32 or 64 bit DLLs: in Quick View, the file&#39;s characteristics should report somewhere &quot;32 bit word machine&quot;; as a rule of thumb, when you see that all the exported functions are in upper case, the DLL is a 16 bit one and you can&#39;t use it. You also can not load a 32 bit DLL into a 64 bit Perl, or vice versa. If you try, <code>new</code>/<code>Import</code> will fail and <code>$^E</code> will be <code>ERROR_BAD_EXE_FORMAT</code>. If their capitalization looks correct, then it&#39;s probably a 32 bit DLL. If you have Platform SDK or Visual Studio, you can use the Dumpbin tool. Call it as <code>dumpbin /exports name_of_dll.dll</code> on the command line. If you have Mingw GCC, use objdump as <code>objdump -x name_of_dll.dll &gt; dlldump.txt</code> and search for the word exports in the very long output.</p>

<p>Also note that many Win32 APIs are exported twice, with the addition of a final <b>A</b> or <b>W</b> to their name, for - respectively - the ASCII and the Unicode version. When a function name is not found, Win32::API will actually append an <b>A</b> to the name and try again; if the extension is built on a Unicode system, then it will try with the <b>W</b> instead. So our function name will be:</p>

<pre><code>    $GetTempPath = new Win32::API::More(&#39;kernel32&#39;, &#39;GetTempPath&#39;, ...</code></pre>

<p>In our case <code>GetTempPath</code> is really loaded as <code>GetTempPathA</code>.</p>

</dd>
<dt id="4."><a id="42"></a><a id="pod3"></a><b>4.</b></dt>
<dd>

<p>The third parameter, the input parameter list, specifies how many arguments the function wants, and their types. It can be passed as a single string, in which each character represents one parameter, or as a list reference. The following forms are valid:</p>

<pre><code>    &quot;abcd&quot;
    [a, b, c, d]
    \@LIST</code></pre>

<p>But those are not:</p>

<pre><code>    (a, b, c, d)
    @LIST</code></pre>

<p>The number of characters, or elements in the list, specifies the number of parameters, and each character or element specifies the type of an argument; allowed types are:</p>

<dl>

<dt id="I:-value-is-an-unsigned-integer-(unsigned-int)"><a id="I"></a><a id="I:-value-is-an-unsigned-integer--unsigned-int"></a><code>I</code>: value is an unsigned integer (unsigned int)</dt>
<dd>

</dd>
<dt id="i:-value-is-an-signed-integer-(signed-int-or-int)"><a id="i"></a><a id="i:-value-is-an-signed-integer--signed-int-or-int"></a><code>i</code>: value is an signed integer (signed int or int)</dt>
<dd>

</dd>
<dt id="N:-value-is-a-unsigned-pointer-sized-number-(unsigned-long)"><a id="N"></a><a id="N:-value-is-a-unsigned-pointer-sized-number--unsigned-long"></a><code>N</code>: value is a unsigned pointer sized number (unsigned long)</dt>
<dd>

</dd>
<dt id="n:-value-is-a-signed-pointer-sized-number-(signed-long-or-long)"><a id="n"></a><a id="n:-value-is-a-signed-pointer-sized-number--signed-long-or-long"></a><code>n</code>: value is a signed pointer sized number (signed long or long)</dt>
<dd>

</dd>
<dt id="Q:-value-is-a-unsigned-64-bit-integer-number-(unsigned-long-long,-unsigned-__int64)-See-next-item-for-details."><a id="Q"></a><a id="Q:-value-is-a-unsigned-64-bit-integer-number--unsigned-long-long--unsigned-__int64--See-next-item-for-details"></a><code>Q</code>: value is a unsigned 64 bit integer number (unsigned long long, unsigned __int64) See next item for details.</dt>
<dd>

</dd>
<dt id="q:-value-is-a-signed-64-bit-integer-number-(long-long,-__int64)-If-your-perl-has-&#39;Q&#39;/&#39;q&#39;-quads-support-for-&quot;pack&quot;-in-perlfunc-then-Win32::API&#39;s-&#39;q&#39;-is-a-normal-perl-numeric-scalar.-All-64-bit-Perls-have-quad-support.-Almost-no-32-bit-Perls-have-quad-support.-On-32-bit-Perls,-without-quad-support,-Win32::API&#39;s-&#39;q&#39;/&#39;Q&#39;-letter-is-a-packed-8-byte-string.-So-0x8000000050000000-from-a-perl-with-native-Quad-support-would-be-written-as-&quot;\x00\x00\x00\x50\x00\x00\x00\x80&quot;-on-a-32-bit-Perl-without-Quad-support.-To-improve-the-use-of-64-bit-integers-with-Win32::API-on-a-32-bit-Perl-without-Quad-support,-there-is-a-per-Win32::API::*-object-setting-called-&quot;UseMI64&quot;-that-causes-all-quads-to-be-accepted-as,-and-returned-as-Math::Int64-objects.-For-&quot;in&quot;-params-in-Win32::API-and-Win32::API::More-and-&quot;out&quot;-in-Win32::API::Callback-only,-if-the-argument-is-a-reference,-it-will-automatically-be-treated-as-a-Math::Int64-object-without-having-to-previously-call-&quot;UseMI64&quot;."><a id="q"></a><a id="q:-value-is-a-signed-64-bit-integer-number--long-long--__int64--If-your-perl-has--Q-q--quads-support-for--pack--in-perlfunc-then-Win32::API-s--q--is-a-normal-perl-numeric-scalar.-All-64-bit-Perls-have-quad-support.-Almost-no-32-bit-Perls-have-quad-support.-On-32-bit-Perls--without-quad-support--Win32::API-s--q-Q--letter-is-a-packed-8-byte-string.-So-0x8000000050000000-from-a-perl-with-native-Quad-support-would-be-written-as--x00-x00-x00-x50-x00-x00-x00-x80--on-a-32-bit-Perl-without-Quad-support.-To-improve-the-use-of-64-bit-integers-with-Win32::API-on-a-32-bit-Perl-without-Quad-support--there-is-a-per-Win32::API::--object-setting-called--UseMI64--that-causes-all-quads-to-be-accepted-as--and-returned-as-Math::Int64-objects.-For--in--params-in-Win32::API-and-Win32::API::More-and--out--in-Win32::API::Callback-only--if-the-argument-is-a-reference--it-will-automatically-be-treated-as-a-Math::Int64-object-without-having-to-previously-call--UseMI64"></a><code>q</code>: value is a signed 64 bit integer number (long long, __int64) If your perl has &#39;Q&#39;/&#39;q&#39; quads support for <a href="functions/CORE.html#pack">&quot;pack&quot; in perlfunc</a> then Win32::API&#39;s &#39;q&#39; is a normal perl numeric scalar. All 64 bit Perls have quad support. Almost no 32 bit Perls have quad support. On 32 bit Perls, without quad support, Win32::API&#39;s &#39;q&#39;/&#39;Q&#39; letter is a packed 8 byte string. So <code>0x8000000050000000</code> from a perl with native Quad support would be written as <code>&quot;\x00\x00\x00\x50\x00\x00\x00\x80&quot;</code> on a 32 bit Perl without Quad support. To improve the use of 64 bit integers with Win32::API on a 32 bit Perl without Quad support, there is a per Win32::API::* object setting called <a href="./Win32::API.html#UseMI64">&quot;UseMI64&quot;</a> that causes all quads to be accepted as, and returned as <a href="https://metacpan.org/pod/Math::Int64">Math::Int64</a> objects. For &quot;in&quot; params in Win32::API and Win32::API::More and &quot;out&quot; in Win32::API::Callback only, if the argument is a reference, it will automatically be treated as a Math::Int64 object without having to previously call <a href="./Win32::API.html#UseMI64">&quot;UseMI64&quot;</a>.</dt>
<dd>

</dd>
<dt id="F:-value-is-a-single-precision-(4-bytes)-floating-point-number-(float)"><a id="F"></a><a id="F:-value-is-a-single-precision--4-bytes--floating-point-number--float"></a><code>F</code>: value is a single precision (4 bytes) floating point number (float)</dt>
<dd>

</dd>
<dt id="D:-value-is-a-double-precision-(8-bytes)-floating-point-number-(double)"><a id="D"></a><a id="D:-value-is-a-double-precision--8-bytes--floating-point-number--double"></a><code>D</code>: value is a double precision (8 bytes) floating point number (double)</dt>
<dd>

</dd>
<dt id="S:-value-is-a-unsigned-short-(unsigned-short)"><a id="S"></a><a id="S:-value-is-a-unsigned-short--unsigned-short"></a><code>S</code>: value is a unsigned short (unsigned short)</dt>
<dd>

</dd>
<dt id="s:-value-is-a-signed-short-(signed-short-or-short)"><a id="s"></a><a id="s:-value-is-a-signed-short--signed-short-or-short"></a><code>s</code>: value is a signed short (signed short or short)</dt>
<dd>

</dd>
<dt id="C:-value-is-a-char-(char),-pass-as-&quot;a&quot;,-not-97,-&quot;abc&quot;-will-truncate-to-&quot;a&quot;"><a id="C"></a><a id="C:-value-is-a-char--char--pass-as--a--not-97---abc--will-truncate-to--a"></a><code>C</code>: value is a char (char), pass as <code>&quot;a&quot;</code>, not <code>97</code>, <code>&quot;abc&quot;</code> will truncate to <code>&quot;a&quot;</code></dt>
<dd>

</dd>
<dt id="P:-value-is-a-pointer-(to-a-string,-structure,-etc...)-padding-out-the-buffer-string-is-required,-buffer-overflow-detection-is-performed.-Pack-and-unpack-the-data-yourself.-If-P-is-a-return-type,-only-null-terminated-strings-or-NULL-pointer-are-supported.-If-P-is-an-in-type,-NULL-is-integer-0.-undef,-&quot;0&quot;,-and-&quot;&quot;+0-are-not-integer-0,-&quot;0&quot;+0-is-integer-0."><a id="P"></a><a id="P:-value-is-a-pointer--to-a-string--structure--etc...--padding-out-the-buffer-string-is-required--buffer-overflow-detection-is-performed.-Pack-and-unpack-the-data-yourself.-If-P-is-a-return-type--only-null-terminated-strings-or-NULL-pointer-are-supported.-If-P-is-an-in-type--NULL-is-integer-0.-undef---0--and--0-are-not-integer-0---0-0-is-integer-0"></a><code>P</code>: value is a pointer (to a string, structure, etc...) padding out the buffer string is required, buffer overflow detection is performed. Pack and unpack the data yourself. If P is a return type, only null terminated strings or NULL pointer are supported. If P is an in type, NULL is integer <code>0</code>. <code>undef</code>, <code>&quot;0&quot;</code>, and <code>&quot;&quot;+0</code> are not integer <code>0</code>, <code>&quot;0&quot;+0</code> is integer <code>0</code>.</dt>
<dd>

<p>It is suggested to not use P as a return type and instead use N and read the memory yourself, and free the pointer if applicable. This pointer is effectively undefined after the C function returns control to Perl. The C function may not hold onto it after the C function returns control. There are exceptions where the pointer will remain valid after the C function returns control, but tread at your own risk, and at your knowledge of Perl interpreter&#39;s C internals.</p>

</dd>
<dt id="T:-value-is-a-Win32::API::Struct-object,-in-parameter-only,-pass-by-reference-(pointer)-only,-pass-by-copy-not-implemented,-see-other-sections-for-more"><a id="T"></a><a id="T:-value-is-a-Win32::API::Struct-object--in-parameter-only--pass-by-reference--pointer--only--pass-by-copy-not-implemented--see-other-sections-for-more"></a><code>T</code>: value is a Win32::API::Struct object, in parameter only, pass by reference (pointer) only, pass by copy not implemented, see other sections for more</dt>
<dd>

</dd>
<dt id="K:-value-is-a-Win32::API::Callback-object,-in-parameter-only,-(see-Win32::API::Callback)"><a id="K"></a><a id="K:-value-is-a-Win32::API::Callback-object--in-parameter-only---see-Win32::API::Callback"></a><code>K</code>: value is a Win32::API::Callback object, in parameter only, (see <a href="https://metacpan.org/pod/Win32::API::Callback">Win32::API::Callback</a>)</dt>
<dd>

</dd>
<dt id="V:-no-value,-no-parameters,-stands-for-void,-may-not-be-combined-with-any-other-letters,-equivalent-to-a-&quot;&quot;"><a id="V"></a><a id="V:-no-value--no-parameters--stands-for-void--may-not-be-combined-with-any-other-letters--equivalent-to-a"></a><code>V</code>: no value, no parameters, stands for <code>void</code>, may not be combined with any other letters, equivalent to a &quot;&quot;</dt>
<dd>

</dd>
</dl>

<p>For beginners, just skip this paragraph. Note, all parameter types are little endian. This is probably what you want unless the documentation for the C function you are calling explicitly says the parameters must be big endian. If there is no documentation for your C function or no mention of endianess in the documentation, this doesn&#39;t apply to you and skip the rest of this paragraph. There is no inherent support for big endian parameters. Perl&#39;s scalar numbers model is that numeric scalars are effectively opaque and their machine representation is irrelevant. On Windows Perl, scalar numbers are little endian internally. So <code>$number = 5; print &quot;$number&quot;;</code> will put 5 on the screen. <code>$number</code> given to Win32::API will pass little endian integer 5 to the C function call. This is almost surly what you want. If you really must pass a big endian integer, do <code>$number = unpack(&#39;L&#39;, pack(&#39;N&#39;, 5));</code>, then <code>print &quot;$number&quot;;</code> will put 83886080 on the screen, but this is big endian 5, and passing 83886080 to <code>-&gt;Call()</code> will make sure that the C function is getting big endian 5. See <a href="https://metacpan.org/pod/perlpacktut">perlpacktut</a> for more.</p>

<p>Our function needs two parameters: a number (<code>DWORD</code>) and a pointer to a string (<code>LPSTR</code>):</p>

<pre><code>    $GetTempPath = new Win32::API(&#39;kernel32&#39;, &#39;GetTempPath&#39;, &#39;NP&#39;, ...</code></pre>

</dd>
<dt id="4.1"><a id="43"></a><a id="pod4"></a><b>4.</b></dt>
<dd>

<p>The fourth is the type of the value returned by the function. It can be one of the types seen above, plus another type named <b>V</b> (for <code>void</code>), used for functions that do not return a value. In our example the value returned by GetTempPath() is a <code>DWORD</code>, which is a typedef for unsigned long, so our return type will be <b>N</b>:</p>

<pre><code>    $GetTempPath = new Win32::API::More(&#39;kernel32&#39;, &#39;GetTempPath&#39;, &#39;NP&#39;, &#39;N&#39;);</code></pre>

<p>Now the line is complete, and the GetTempPath() API is ready to be used in Perl. Before calling it, you should test that $GetTempPath is <a href="functions/CORE.html#defined">&quot;defined&quot; in perlfunc</a>, otherwise errors such as the function or the library could not be loaded or the C prototype was unparsable happened, and no object was created. If the return value is undefined, to get detailed error status, use <a href="variables/$&lt;digits&gt;-($1,-$2,-...).html#$%5EE">&quot;$^E&quot; in perlvar</a> or <a href="https://metacpan.org/pod/Win32#Win32::GetLastError()">Win32::GetLastError</a>. <code>$^E</code> is slower than <code>Win32::GetLastError</code> and useless on Cygwin, but <code>$^E</code> in string context provides a readable description of the error. In numeric context, <code>$^E</code> is equivelent to <code>Win32::GetLastError</code>. <code>Win32::GetLastError</code> always returns an integer error code. You may use <a href="https://metacpan.org/pod/Win32#Win32::FormatMessage()">Win32::FormatMessage</a> to convert an integer error code to a readable description on Cygwin and Native builds of Perl.</p>

<p>Our definition, with error checking added, should then look like this:</p>

<pre><code>    $GetTempPath = new Win32::API::More(&#39;kernel32&#39;, &#39;GetTempPath&#39;, &#39;NP&#39;, &#39;N&#39;);
    if(not defined $GetTempPath) {
        die &quot;Can&#39;t import API GetTempPath: $^E\n&quot;;
    }</code></pre>

</dd>
</dl>

<h2 id="CALLING-AN-IMPORTED-FUNCTION"><a id="CALLING"></a>CALLING AN IMPORTED FUNCTION</h2>

<p>To effectively make a call to an imported function you must use the Call() method on the Win32::API object you created. Continuing with the example from the previous paragraph, the GetTempPath() API can be called using the method:</p>

<pre><code>    $GetTempPath-&gt;Call(...</code></pre>

<p>Of course, parameters have to be passed as defined in the import phase. In particular, if the number of parameters does not match (in the example, if GetTempPath() is called with more or less than two parameters), Perl will <code>croak</code> an error message and <code>die</code>.</p>

<p>The two parameters needed here are the length of the buffer that will hold the returned temporary path, and a pointer to the buffer itself. For numerical parameters except for char, you can use either a constant expression or a variable, it will be numified similar to the expression <code>($var+0)</code>. For pointers, also note that <b>memory must be allocated before calling the function</b>, just like in C. For example, to pass a buffer of 80 characters to GetTempPath(), it must be initialized before with:</p>

<pre><code>    $lpBuffer = &quot; &quot; x 80;</code></pre>

<p>This allocates a string of 80 characters. If you don&#39;t do so, you&#39;ll probably get a fatal buffer overflow error starting in 0.69. The call should therefore include:</p>

<pre><code>    $lpBuffer = &quot; &quot; x 80;
    $GetTempPath-&gt;Call(80, $lpBuffer);</code></pre>

<p>And the result will be stored in the $lpBuffer variable. Note that you never need to pass a reference to the variable (eg. you <b>don&#39;t need</b> <code>\$lpBuffer</code>), even if its value will be set by the function.</p>

<p>A little problem here is that Perl does not trim the variable, so $lpBuffer will still contain 80 characters in return; the exceeding characters will be spaces, because we said <code>&quot; &quot; x 80</code>.</p>

<p>In this case we&#39;re lucky enough, because the value returned by the GetTempPath() function is the length of the string, so to get the actual temporary path we can write:</p>

<pre><code>    $lpBuffer = &quot; &quot; x 80;
    $return = $GetTempPath-&gt;Call(80, $lpBuffer);
    $TempPath = substr($lpBuffer, 0, $return);</code></pre>

<p>If you don&#39;t know the length of the string, you can usually cut it at the <code>\0</code> (ASCII zero) character, which is the string delimiter in C:</p>

<pre><code>    $TempPath = ((split(/\0/, $lpBuffer))[0];  
    # or    
    $lpBuffer =~ s/\0.*$//;</code></pre>

<h2 id="USING-STRUCTURES"><a id="USING"></a>USING STRUCTURES</h2>

<p>Starting from version 0.40, Win32::API comes with a support package named Win32::API::Struct. The package is loaded automatically with Win32::API, so you don&#39;t need to use it explicitly.</p>

<p>With this module you can conveniently define structures and use them as parameters to Win32::API functions. A short example follows:</p>

<pre><code>    # the &#39;POINT&#39; structure is defined in C as:
    #     typedef struct {
    #        LONG  x;
    #        LONG  y;
    #     } POINT;
    

    #### define the structure
    Win32::API::Struct-&gt;typedef( POINT =&gt; qw{
        LONG x; 
        LONG y; 
    });
    
    #### import an API that uses this structure
    Win32::API-&gt;Import(&#39;user32&#39;, &#39;BOOL GetCursorPos(LPPOINT lpPoint)&#39;);
    
    #### create a &#39;POINT&#39; object
    my $pt = Win32::API::Struct-&gt;new(&#39;POINT&#39;);
    
    #### call the function passing our structure object
    GetCursorPos($pt);
    
    #### and now, access its members
    print &quot;The cursor is at: $pt-&gt;{x}, $pt-&gt;{y}\n&quot;;</code></pre>

<p>Note that this works only when the function wants a <b>pointer to a structure</b>, not a &quot;pass by copy&quot; structure. As you can see, our structure is named &#39;POINT&#39;, but the API used &#39;LPPOINT&#39;. Some heuristics are done to validate the argument&#39;s type vs the parameter&#39;s type if the function has a C prototype definition (not letter definition). First, if the parameter type starts with the LP prefix, the LP prefix is stripped, then compared to the argument&#39;s type. If that fails, the Win32::API::Type database (see <a href="https://metacpan.org/pod/Win32::API::Type#typedef">&quot;typedef&quot; in Win32::API::Type</a>) will be used to convert the parameter type to the base type. If that fails, the parameter type will be stripped of a trailing whitespace then a &#39;*&#39;, and then checked against the base type. <a href="functions/CORE.html#die">Dies</a> if the parameter and argument types do not match after 3 attempts.</p>

<p>For more information, see also <a href="https://metacpan.org/pod/Win32::API::Struct">Win32::API::Struct</a>.</p>

<p>If you don&#39;t want (or can&#39;t) use the <code>Win32::API::Struct</code> facility, you can still use the low-level approach to use structures:</p>

<ol>

<li><p>you have to <a href="functions/CORE.html#pack">pack()</a> the required elements in a variable:</p>

<pre><code>    $lpPoint = pack(&#39;ll&#39;, 0, 0); # store two LONGs</code></pre>

</li>
<li><p>to access the values stored in a structure, <a href="functions/CORE.html#unpack">unpack()</a> it as required:</p>

<pre><code>    ($x, $y) = unpack(&#39;;;&#39;, $lpPoint); # get the actual values</code></pre>

</li>
</ol>

<p>The rest is left as an exercise to the reader...</p>

<h2 id="EXPORTED-FUNCTIONS"><a id="EXPORTED"></a>EXPORTED FUNCTIONS</h2>

<h3 id="ReadMemory">ReadMemory</h3>

<pre><code>    $copy_of_memblock = ReadMemory($SourcePtr, $length);</code></pre>

<p>Reads the source pointer for <code>$length</code> number of bytes. Returns a copy of the memory block in a scalar. No readability checking is done on <code>$SourcePtr</code>. <code>$SourcePtr</code>&#39;s format is 123456, not <code>&quot;\x01\x02\x03\x04&quot;</code>.</p>

<h3 id="WriteMemory">WriteMemory</h3>

<pre><code>    WriteMemory($DestPtr, $sourceScalar, $length);</code></pre>

<p>Copies the string contents of the <code>$sourceScalar</code> scalar to <code>$DestPtr</code> for <code>$length</code> bytes. $length must be less than or equal to the length of <code>$sourceScalar</code>, otherwise the function croaks. No readability checking is done on <code>$DestPtr</code>. <code>$DestPtr</code>&#39;s format is 123456, not <code>&quot;\x01\x02\x03\x04&quot;</code>. Returns nothing.</p>

<h3 id="MoveMemory">MoveMemory</h3>

<pre><code>    MoveMemory($destPtr, $sourcePtr, $length);</code></pre>

<p>Copies a block of memory from one location to another. The source and destination blocks may overlap. All pointers are in the format of 123456, not <code>&quot;\x01\x02\x03\x04&quot;</code>. No readability checking is done. Returns nothing.</p>

<h3 id="IsBadReadPtr">IsBadReadPtr</h3>

<pre><code>    if(IsBadReadPtr($ptr, $length)) {die &quot;bad ptr&quot;;}</code></pre>

<p>Probes a memory block for <code>$length</code> bytes for readability. Returns true if access violation occurs, otherwise false is returned. This function is useful to avoid dereferencing pointers which will crash the perl process. This function has many limitations, including not detecting uninitialized memory, not detecting freed memory, and not detecting gibberish. It can not tell whether a function pointer is valid x86 machine code. Ideally, you should never use it, or remove it once your code is stable. <code>$ptr</code> is in the format of 123456, not <code>&quot;\x01\x02\x03\x04&quot;</code>. See MS&#39;s documentation for a lot more on this function of the same name.</p>

<h3 id="SafeReadWideCString">SafeReadWideCString</h3>

<pre><code>    $source = Encode::encode(&quot;UTF-16LE&quot;,&quot;Just another perl h\x{00E2}cker\x00&quot;);
    $string = SafeReadWideCString(unpack(&#39;J&#39;,pack(&#39;p&#39;, $source)));
    die &quot;impossible&quot; if $source ne &quot;Just another perl h\x{00E2}cker&quot;;</code></pre>

<p>Safely (SEH aware) reads a utf-16 wide null terminated string (the first and only parameter), into a scalar. Returns undef, if an access violation happens or null pointer (same thing). The string pointer is in the format of 123456, not <code>&quot;\x01\x02\x03\x04&quot;</code>. The returned scalar will be UTF8 marked if the string can not be represented in the system&#39;s ANSI codepage. Conversion is done with WideCharToMultiByte. Returns a 0 length scalar string if WideCharToMultiByte fails. This function was created because <a href="functions/CORE.html#pack">pack&#39;s</a> p letter won&#39;t read UTF16 and <a href="./Win32::API.html#ReadMemory">&quot;ReadMemory&quot;</a> and <a href="./Win32::API.html#IsBadReadPtr">&quot;IsBadReadPtr&quot;</a> require an explicit length.</p>

<h2 id="CONSTRUCTORS">CONSTRUCTORS</h2>

<h3 id="new">new</h3>

<pre><code>    $obj = Win32::API::More-&gt;new([$dllname | (undef , $funcptr)], [$c_proto | ($in, $out [, $calling_convention])]);</code></pre>

<p>See <a href="./Win32::API.html#DESCRIPTION">&quot;DESCRIPTION&quot;</a>.</p>

<h3 id="Import-$obj-=-Win32::API::More-&gt;Import([$dllname-|-(undef-,-$funcptr)],-[$c_proto-|-($in,-$out-[,-$calling_convention])]);"><a id="Import"></a><a id="Import--obj---Win32::API::More--Import-dllname----undef----funcptr---c_proto----in---out----calling_convention"></a>Import $obj = Win32::API::More-&gt;Import([$dllname | (undef , $funcptr)], [$c_proto | ($in, $out [, $calling_convention])]);</h3>

<p>See <a href="./Win32::API.html#DESCRIPTION">&quot;DESCRIPTION&quot;</a>.</p>

<h2 id="METHODS">METHODS</h2>

<h3 id="Call">Call</h3>

<p>The main method of a Win32::API object. Documented elsewhere in this document.</p>

<h3 id="UseMI64">UseMI64</h3>

<pre><code>    $bool = $APIObj-&gt;UseMI64();
    $oldbool = $APIObj-&gt;UseMI64($newbool);</code></pre>

<p>Turns on Quads as <a href="https://metacpan.org/pod/Math::Int64">Math::Int64</a> objects support for a particular object instance. You must call <a href="functions/CORE.html#use">&quot;use&quot; in perlfunc</a>/<a href="functions/CORE.html#require">&quot;require&quot; in perlfunc</a> on Math::Int64 before calling UseMI64. Win32::API does not <code>use</code> Math::Int64 for you. Works on Win32::API and Win32::API::Callback objects. This method does not exist if your Perl natively supports Quads (64 bit Perl for example). Takes 1 optional parameter, which is a true or false value to use or don&#39;t use Math::Int64, returns the old setting, which is a true or false value. If called without any parameters, returns current setting, which is a true or false value, without setting the option. As discussed in <a href="./Win32::API.html#q">&quot;q&quot;</a>, if you are not using Math::Int64 you must supply/will receive 8 byte scalar strings for quads. For &quot;in&quot; params in Win32::API and Win32::API::More and &quot;out&quot; in Win32::API::Callback only, if the argument is a reference, it will automatically be treated as a Math::Int64 object without having to previously call this function.</p>

<h2 id="VERBOSE-DEBUGGING"><a id="VERBOSE"></a>VERBOSE DEBUGGING</h2>

<p>If using <code>Win32::GetLastError</code> and <code>$^E</code> does not reveal the problem with your use of Win32::API, you may turn on Win32::API&#39;s very verbose debugging mode as follows</p>

<pre><code>    BEGIN {
        $Win32::API::DEBUG = 1;
    }
    use Win32::API;
    $function = Win32::API::More-&gt;new(
        &#39;mydll&#39;, &#39;int sum_integers(int a, int b)&#39;
    );</code></pre>

<h1 id="HISTORY">HISTORY</h1>

<dl>

<dt id="UseMI64-API-change"><a id="UseMI641"></a>UseMI64 API change</dt>
<dd>

<p>Starting in 0.71, UseMI64 on a set returns old value, not previously new value.</p>

</dd>
<dt id="fork-safe"><a id="fork"></a>fork safe</dt>
<dd>

<p>Starting in 0.71, a Win32::API object can go through a fork and work correctly in the child and parent psuedo-processes. Previously when either psuedo-processes exited, the DLL would be unloaded and the other psuedo-processes would crash if a Call() was done on the object.</p>

</dd>
<dt id="return-value-signedness"><a id="return"></a>return value signedness</dt>
<dd>

<p>Prior to 0.69, for numeric integer types, the return scalar was always signed. Unsigned-ness was ignored.</p>

</dd>
<dt id="shorts">shorts</dt>
<dd>

<p>Prior to 0.69, shorts were not supported. &#39;S&#39; meant a sturct. To fix this Win32::API::More class was created for 0.69. &#39;S&#39;/&#39;s&#39; now means short, per pack&#39;s letters. Struct has been moved to letter &#39;T&#39;. Win32::API will continue to exist for legacy code.</p>

</dd>
<dt id="float-return-types"><a id="float"></a>float return types</dt>
<dd>

<p>Prior to 0.69, if a function had a return type of float, it was silently not called.</p>

</dd>
<dt id="buffer-overflow-protection"><a id="buffer"></a>buffer overflow protection</dt>
<dd>

<p>Introduced in 0.69. If disabling is required, which is highly <b>not recommended</b>, set an environmental variable called WIN32_API_SORRY_I_WAS_AN_IDIOT to 1.</p>

</dd>
<dt id="automatic-un/pack"><a id="automatic"></a><a id="automatic-un-pack"></a>automatic un/pack</dt>
<dd>

<p>Starting with 0.69, when using Win32::API::More, there is automatic un/packing of pointers to numbers-ish things for in parameters when using the C prototype interface.</p>

</dd>
<dt id="Quads-on-32-bit"><a id="Quads"></a>Quads on 32 bit</dt>
<dd>

<p>Added in 0.70.</p>

</dd>
<dt id="__stdcall-vs-__cdecl-checking-on-32-bits"><a id="__stdcall"></a><a id="stdcall-vs-__cdecl-checking-on-32-bits"></a>__stdcall vs __cdecl checking on 32 bits</dt>
<dd>

<p>Added in 0.76_01</p>

</dd>
<dt id="Import-returns-an-api-obj-on-success,-undef-on-failure,-instead-of-1-or-0"><a id="Import1"></a><a id="Import-returns-an-api-obj-on-success--undef-on-failure--instead-of-1-or-0"></a>Import returns an api obj on success, undef on failure, instead of 1 or 0</dt>
<dd>

<p>Added in 0.76_02</p>

</dd>
<dt id="checking-$!-for-new/Import-failure-is-broken-and-deprecated"><a id="checking"></a><a id="checking---for-new-Import-failure-is-broken-and-deprecated"></a>checking <code>$!</code> for <code>new</code>/<code>Import</code> failure is broken and deprecated</dt>
<dd>

<p>Starting in 0.76_06, due to many bugs with <code>new</code> and <code>Import</code> not setting <a href="variables/$&lt;digits&gt;-($1,-$2,-...).html#$!">&quot;$!&quot; in perlvar</a> or Win32 and C error codes overlapping and Win32 error codes being stringified as different C error codes, checking <code>$!</code> is deprecated and the existing, partial setting of <code>$!</code>, maybe removed in the future. Only check <code>Win32::GetLastError()</code> or <code>$^E</code> to find out why the call failed.</p>

</dd>
</dl>

<p>See the <code>Changes</code> file for more details, many of which not mentioned here.</p>

<h1 id="BUGS-AND-LIMITATIONS"><a id="BUGS"></a>BUGS AND LIMITATIONS</h1>

<dl>

<dt id="&nbsp;-Unicode-DLL-paths"><a id="Unicode-DLL-paths"></a>&nbsp; Unicode DLL paths</dt>
<dd>

<p>Untested.</p>

</dd>
<dt id="&nbsp;-ithreads"><a id="ithreads"></a>&nbsp; ithreads</dt>
<dd>

<p>Minimally tested.</p>

</dd>
<dt id="&nbsp;-C-functions-getting-utf8-scalars-vs-byte-scalars"><a id="C-functions-getting-utf8-scalars-vs-byte-scalars"></a>&nbsp; C functions getting utf8 scalars vs byte scalars</dt>
<dd>

<p>Untested and undefined.</p>

</dd>
</dl>

<h1 id="SEE-ALSO"><a id="SEE"></a>SEE ALSO</h1>

<p><a href="https://metacpan.org/pod/Math::Int64">Math::Int64</a></p>

<p><a href="https://metacpan.org/pod/Win32::API::Struct">Win32::API::Struct</a></p>

<p><a href="https://metacpan.org/pod/Win32::API::Type">Win32::API::Type</a></p>

<p><a href="https://metacpan.org/pod/Win32::API::Callback">Win32::API::Callback</a></p>

<p><a href="https://metacpan.org/pod/distribution/Win32-API/IATPatch.pod">Win32::API::Callback::IATPatch</a></p>

<p><a href="http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/function-calling-conventions.html">http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/function-calling-conventions.html</a></p>

<h1 id="AUTHOR">AUTHOR</h1>

<p>Aldo Calpini ( <i>dada@perl.it</i> ).</p>

<h1 id="MAINTAINER">MAINTAINER</h1>

<p>Cosimo Streppone ( <i>cosimo@cpan.org</i> )</p>

<h1 id="MAJOR-CONTRIBUTOR"><a id="MAJOR"></a>MAJOR CONTRIBUTOR</h1>

<p>Daniel Dragan ( <i>bulkdd@cpan.org</i> )</p>

<h1 id="LICENSE">LICENSE</h1>

<p>To finally clarify this, <code>Win32::API</code> is OSI-approved free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p>

<p>See <a href="http://dev.perl.org/licenses/artistic.html">http://dev.perl.org/licenses/artistic.html</a></p>

<h1 id="CREDITS">CREDITS</h1>

<p>All the credits go to Andrea Frosini for the neat assembler trick that makes this thing work. I&#39;ve also used some work by Dave Roth for the prototyping stuff. A big thank you also to Gurusamy Sarathy for his invaluable help in XS development, and to all the Perl community for being what it is.</p>

<p>Cosimo also wants to personally thank everyone that contributed to Win32::API with complaints, emails, patches, RT bug reports and so on.</p></div>

<div id="metacpan_install-instructions-dialog" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Module Install Instructions</h4>
      </div>
      <div class="modal-body">
        <p>To install Win32::API, copy and paste the appropriate command in to your terminal.</p>
        <p><a href="https://metacpan.org/dist/App-cpanminus/view/bin/cpanm">cpanm</a></p>
        <pre><code>cpanm Win32::API</code></pre>
        <p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
        <pre><code>perl -MCPAN -e shell
install Win32::API</code></pre>
        <p>For more information on module installation, please visit <a href="https://www.cpan.org/modules/INSTALL.html">the detailed CPAN module installation guide</a>.</p>
      </div>
      <div class="modal-footer">
        <a href="./Win32::API.html#" data-dismiss="modal" class="btn">Close</a>
      </div>
    </div>
  </div>
</div>
          </main>
          <div class="content-pagination">
          </div>
        </div>
        <footer class="footer">
          <div class="footer-container">
            <div class="footer-social">
              <div class="footer-link footer-logo">
                <a href="https://metacpan.org/">
                  <img src="https://metacpan.org/static/images/metacpan-logo.svg" alt="MetaCPAN" />
                </a>
              </div>
              <a class="footer-social-link" href="https://github.com/metacpan">
                <i class="fab fa-github-square"></i>
              </a>
              <a class="footer-social-link" href="https://fosstodon.org/@metacpan">
                <i class="fab fa-mastodon"></i>
              </a>
            </div>
            <div class="footer-links">
              <div class="footer-link">
                  <a href="https://metacpan.org/about">About</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/sponsors">Sponsor</a>
              </div>
              <div class="footer-link">
                  <a href="https://grep.metacpan.org">grep::cpan</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/recent">Recent</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/faq">FAQ</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/tools">Tools</a>
              </div>
              <div class="footer-link">
                  <a href="https://fastapi.metacpan.org/">API</a>
              </div>
              <div class="footer-link">
                  <a href="https://www.perl.org/">Perl.org</a>
              </div>
            </div>
            <div class="footer-sponsors">
              <a class="footer-sponsor-link" target="_blank" href="https://www.bytemark.co.uk/" rel="noopener">
                <img class="footer-sponsor-bytemark" src="https://metacpan.org/static/images/sponsors/bytemark_logo.svg" alt="Bytemark logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.liquidweb.com/" rel="noopener">
                <img class="footer-sponsor-liquidweb" src="https://metacpan.org/static/images/sponsors/liquidweb_logo.png" alt="liquidweb logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://deriv.com/careers/" rel="noopener">
                <img class="footer-sponsor-deriv" src="https://metacpan.org/static/images/sponsors/deriv.svg" alt="Deriv logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://geocode.xyz" rel="noopener">
                <img class="footer-sponsor-geocode" src="https://metacpan.org/static/images/sponsors/geocodelogo.svg" alt="Geocode logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.fastly.com/" rel="noopener">
                <img class="footer-sponsor-fastly" src="https://metacpan.org/static/images/sponsors/fastly_logo.svg" alt="Fastly logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://opencagedata.com" rel="noopener">
                <img class="footer-sponsor-opencage" src="https://metacpan.org/static/images/sponsors/open-cage.svg" alt="OpenCage logo">
              </a>
            </div>
          </div>
        </footer>
        <div class="modal fade" tabindex="-1" role="dialog" id="metacpan_keyboard-shortcuts">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Keyboard Shortcuts</h4>
              </div>
              <div class="modal-body row">
<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Global</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>s</kbd>
        </td>
        <td>Focus search bar</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>?</kbd>
        </td>
        <td>Bring up this help dialog</td>
      </tr>
    </tbody>
  </table>

  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>GitHub</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>p</kbd>
        </td>
        <td>Go to pull requests</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>go to github issues (only if github is preferred repository)</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>POD</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>a</kbd>
        </td>
        <td>Go to author</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>c</kbd>
        </td>
        <td>Go to changes</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>Go to issues</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>d</kbd>
        </td>
        <td>Go to dist</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>r</kbd>
        </td>
        <td>Go to repository/SCM</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>s</kbd>
        </td>
        <td>Go to source</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>b</kbd>
        </td>
        <td>Go to file browse</td>
      </tr>

    </tbody>
  </table>
</div>

<div class="col-md-12">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Search terms</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><em>module:</em> (e.g. <a href="https://metacpan.org/search?q=module%3APlugin">module:Plugin</a>)</td>
      </tr>
      <tr>
        <td><em>distribution:</em> (e.g. <a href="https://metacpan.org/search?q=distribution%3ADancer+auth">distribution:Dancer auth</a>)</td>
      </tr>
      <tr>
        <td><em>author:</em> (e.g. <a href="https://metacpan.org/search?q=author%3ASONGMU+Redis">author:SONGMU Redis</a>)</td>
      </tr>
      <tr>
        <td><em>version:</em> (e.g. <a href="https://metacpan.org/search?q=version%3A1.00">version:1.00</a>)</td>
      </tr>
    </tbody>
  </table>
</div>
              </div>
              <div class="modal-footer"></div>
            </div>
          </div>
        </div>
    </body>
</html>
